import React, {Component} from 'react'
import {buildQuery} from "../utils/tools"

export default class BetCenterLeftTab extends Component {
  constructor (props){
   super(props)
   this.lefttab=this.props.lefttab
   this.state= {
    hover:0
   }
}

chooseCodeType(code,index){
  this.setState({
    hover:index
  })
  this.lefttab(code,index)
  
}

componentWillReceiveProps(nextprops){
  if(nextprops.gameCode != this.props.gameCode){
    this.setState({
      hover:0
    })
  }
}


   render() {
    const {itemList,gameCode,PLitemcode,betcenter} = this.props
    const {hover} = this.state
    
    // let num =  Object.keys(betcenter.get("selectPeiyu")).length
    return  <ul>
    { itemList &&
      itemList.map((item,index)=>{
        return <li key={index} className={hover == index ? "hover" : ""}
         onClick={()=>{this.chooseCodeType(item.itemCode,index)}}>{item.itemName}</li>
      })
    }
    {/* <div className="backorder" onClick={()=>{this.props. history.push('/ordermoney?'+buildQuery({
          gameCode: gameCode,
          pankou:PLitemcode,
        }))}}>
      <p>返回投注清单 
        {
          num  > 0 ? <i>{num}</i> : ""
        }
        </p>
    </div> */}

  </ul>
   }
}